<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OrangeCNC - ARISC firmware documentation: mod_msg.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OrangeCNC - ARISC firmware documentation
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('mod__msg_8c.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">mod_msg.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>ARM-ARISC message control module.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;string.h&gt;</code><br />
<code>#include &quot;<a class="el" href="mod__msg_8h_source.html">mod_msg.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a577ee695bade6a55efa4c5a7d9866a74"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mod__msg_8c.html#a577ee695bade6a55efa4c5a7d9866a74">msg_module_init</a> (void)</td></tr>
<tr class="memdesc:a577ee695bade6a55efa4c5a7d9866a74"><td class="mdescLeft">&#160;</td><td class="mdescRight">module init  <a href="#a577ee695bade6a55efa4c5a7d9866a74">More...</a><br /></td></tr>
<tr class="separator:a577ee695bade6a55efa4c5a7d9866a74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7611d9252e22be0140ad3beb46eb8a2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mod__msg_8c.html#ac7611d9252e22be0140ad3beb46eb8a2">msg_module_base_thread</a> (void)</td></tr>
<tr class="memdesc:ac7611d9252e22be0140ad3beb46eb8a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">module base thread  <a href="#ac7611d9252e22be0140ad3beb46eb8a2">More...</a><br /></td></tr>
<tr class="separator:ac7611d9252e22be0140ad3beb46eb8a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aad162e5eb1e3fb9806dc50c01ecb7d70"><td class="memItemLeft" align="right" valign="top">int8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mod__msg_8c.html#aad162e5eb1e3fb9806dc50c01ecb7d70">msg_send</a> (uint8_t type, uint8_t *msg, uint8_t length)</td></tr>
<tr class="memdesc:aad162e5eb1e3fb9806dc50c01ecb7d70"><td class="mdescLeft">&#160;</td><td class="mdescRight">send a message to the ARM cpu  <a href="#aad162e5eb1e3fb9806dc50c01ecb7d70">More...</a><br /></td></tr>
<tr class="separator:aad162e5eb1e3fb9806dc50c01ecb7d70"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51c02043fa74dd30c73670ca0c066727"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mod__msg_8c.html#a51c02043fa74dd30c73670ca0c066727">msg_recv_callback_add</a> (uint8_t msg_type, <a class="el" href="mod__msg_8h.html#a374ff7872dc0e70bbc8b4c5273b2c703">msg_recv_func_t</a> func)</td></tr>
<tr class="memdesc:a51c02043fa74dd30c73670ca0c066727"><td class="mdescLeft">&#160;</td><td class="mdescRight">add the function to the list of "message received callbacks"  <a href="#a51c02043fa74dd30c73670ca0c066727">More...</a><br /></td></tr>
<tr class="separator:a51c02043fa74dd30c73670ca0c066727"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99224966c8fcbf2162a8949640e99684"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mod__msg_8c.html#a99224966c8fcbf2162a8949640e99684">msg_recv_callback_remove</a> (uint8_t msg_type)</td></tr>
<tr class="memdesc:a99224966c8fcbf2162a8949640e99684"><td class="mdescLeft">&#160;</td><td class="mdescRight">remove the callback function from the list of "message received callbacks"  <a href="#a99224966c8fcbf2162a8949640e99684">More...</a><br /></td></tr>
<tr class="separator:a99224966c8fcbf2162a8949640e99684"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>ARM-ARISC message control module. </p>
<p>This module implements an API to communication between ARISC and ARM processors </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a577ee695bade6a55efa4c5a7d9866a74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a577ee695bade6a55efa4c5a7d9866a74">&#9670;&nbsp;</a></span>msg_module_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void msg_module_init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>module init </p>
<dl class="section note"><dt>Note</dt><dd>call this function only once before <a class="el" href="mod__msg_8c.html#ac7611d9252e22be0140ad3beb46eb8a2" title="module base thread ">msg_module_base_thread()</a> </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="mod_msg_8c-example.html#a3">mod_msg.c</a>.</dd>
</dl>
</div>
</div>
<a id="ac7611d9252e22be0140ad3beb46eb8a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7611d9252e22be0140ad3beb46eb8a2">&#9670;&nbsp;</a></span>msg_module_base_thread()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void msg_module_base_thread </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>module base thread </p>
<dl class="section note"><dt>Note</dt><dd>call this function at the top of main loop </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="mod_msg_8c-example.html#a6">mod_msg.c</a>.</dd>
</dl>
</div>
</div>
<a id="aad162e5eb1e3fb9806dc50c01ecb7d70"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aad162e5eb1e3fb9806dc50c01ecb7d70">&#9670;&nbsp;</a></span>msg_send()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int8_t msg_send </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>msg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>send a message to the ARM cpu </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">type</td><td>user defined message type (0..0xFF) </td></tr>
    <tr><td class="paramname">msg</td><td>pointer to the message buffer </td></tr>
    <tr><td class="paramname">length</td><td>the length of a message (0 ..MSG_LEN)</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">0</td><td>(message sent) </td></tr>
    <tr><td class="paramname">-1</td><td>(message not sent) </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="mod_msg_8c-example.html#a0">mod_msg.c</a>.</dd>
</dl>
</div>
</div>
<a id="a51c02043fa74dd30c73670ca0c066727"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a51c02043fa74dd30c73670ca0c066727">&#9670;&nbsp;</a></span>msg_recv_callback_add()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void msg_recv_callback_add </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>msg_type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="mod__msg_8h.html#a374ff7872dc0e70bbc8b4c5273b2c703">msg_recv_func_t</a>&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>add the function to the list of "message received callbacks" </p>
<dl class="section note"><dt>Note</dt><dd>the callback function must have 3 arguments, same as for the <a class="el" href="mod__msg_8c.html#aad162e5eb1e3fb9806dc50c01ecb7d70" title="send a message to the ARM cpu ">msg_send()</a> function</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">msg_type</td><td>user defined message type (0..0xFF) </td></tr>
    <tr><td class="paramname">func</td><td>pointer to the callback function</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="mod_msg_8c-example.html#a4">mod_msg.c</a>.</dd>
</dl>
</div>
</div>
<a id="a99224966c8fcbf2162a8949640e99684"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99224966c8fcbf2162a8949640e99684">&#9670;&nbsp;</a></span>msg_recv_callback_remove()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void msg_recv_callback_remove </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>msg_type</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>remove the callback function from the list of "message received callbacks" </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">msg_type</td><td>user defined message type (0..0xFF) </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">none</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="mod_msg_8c-example.html#a1">mod_msg.c</a>.</dd>
</dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="mod__msg_8c.html">mod_msg.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
